﻿using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using DbScript.Properties;
using NUnit.Framework;

namespace DbScript
{
    [TestFixture]
    public class Class1
    {
        [Test]
        public void ReCreateDb()
        {
            using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ButterflyCakes"].ConnectionString))
            {
                connection.Open();
                using (var destroyCommand = connection.CreateCommand())
                {
                    destroyCommand.CommandText = Resources.DestroyTables;
                    destroyCommand.CommandType = CommandType.Text;
                    destroyCommand.ExecuteNonQuery();
                }

                using (var createCommand = connection.CreateCommand())
                {
                    createCommand.CommandText = Resources.CreateDb;
                    createCommand.CommandType = CommandType.Text;
                    createCommand.ExecuteNonQuery();
                }

                using (var changeCommand = connection.CreateCommand())
                {
                    changeCommand.CommandText = Resources.ChangeDb;
                    changeCommand.CommandType = CommandType.Text;
                    //changeCommand.ExecuteNonQuery();
                }
            }
        }
    }
}
